﻿using System;

namespace QuailDb
{
    public class QuailObjectContextConnection : IDisposable
    {
        // private static readonly EasyFactory<QuailDataContext> Contexts = new EasyFactory<QuailDataContext>();
        public QuailObjectContextConnection()
        {
            // Potentially we could make the connection configurable here
            Context = new QuailDataContext(); // Contexts.Get();
        }

        public QuailDataContext Context
        {
            get; private set;
        }

        public static void ClearFactory()
        {
            // Contexts.Clear();
        }

        public void Dispose()
        {
            if (Context != null)
            {
                // Contexts.Replace(Context);
                Context = null;
            }
        }
    }
}
